
using System;
using Newtonsoft.Json;

namespace MR.Common
{
    public enum GoalType
    {
        ERack = 0,
        Equipment,
    }
    public enum TargetAction
    {
        Pickup = 0,
        Dropoff,
        Swap,
    }
    public class Target
    {
        public Guid Id { get; private set; } = Guid.NewGuid();
        [JsonProperty("action")]
        public int Action { get; set; }
        [JsonProperty("priority")]
        public int Priority { get; set; }
        [JsonProperty("src")]
        public SubTask Src { get; set; }
        [JsonProperty("dest")]
        public SubTask Dest { get; set; }
        public TargetAction TargetAction { get => (TargetAction)Action; }

        public static Target Establish(int action,int priority) => new Target()
        {
            Action = action,
            Priority = priority,
        };
    }
    public class SubTask
    {
        [JsonProperty("goal")]
        public string Goal { get; set; }
        [JsonProperty("position")]
        public int Position { get; set; }
        [JsonProperty("lot")]
        public string Lot { get; set; }
        [JsonProperty("qty")]
        public int Quantity { get; set; }
        [JsonProperty("type")]
        public int Type { get; set; }
        public GoalType GoalType { get => (GoalType)Type; }
    }
}